package com.wtwd.campus.model.vo;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author zdl
 * @Description
 * @create 2021-07-02 13:57
 */
@ApiModel("分页对象")
public class MyPage<T>  implements IPage<T>  {


    private static final long serialVersionUID = 1L;
    @ApiModelProperty("数据行")
    protected List<T> rows;
    @ApiModelProperty("数据总数")
    protected long total;
    @ApiModelProperty("数据行大小")
    protected long size;
    @ApiModelProperty("当前页数")
    protected long current;

    protected transient List<T> records;

    protected transient boolean hitCount;

    @Override
    public List<OrderItem> orders() {
        return null;
    }

    @Override
    public List<T> getRecords() {
        return null;
    }

    @Override
    public MyPage<T> setRecords(List<T> records) {
        this.rows = records;
        return this;
    }

    @Override
    public long getTotal() {
        return this.total;
    }

    @Override
    public IPage<T> setTotal(long total) {
        this.total = total;
        return this;
    }


    @Override
    public long getSize() {
        return this.size;
    }

    @Override
    public IPage<T> setSize(long size) {
        this.size =size;
        return this;
    }

    @Override
    public long getCurrent() {
        return this.current;
    }

    @Override
    public IPage<T> setCurrent(long current) {
        this.current =current;
        return this;
    }

    public MyPage(long current, long size) {
        this(0L, size, current);
    }

    public MyPage(long total, long size, long current) {
        this.total = total;
        this.size = size;
        this.current = current;
    }

    public MyPage() {
        this.rows = Collections.emptyList();
        this.total = 0L;
        this.size = 10L;
        this.current = 1L;
    }

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }
}
